﻿<Controls:SinacorWindow
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
    xmlns:Custom="http://schemas.xceed.com/wpf/xaml/datagrid"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d"
    xmlns:Controls="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient;assembly=Sinacor.Infra.UI.Controls"
    WindowStartupLocation="CenterScreen" 
    WindowState="Maximized" 
    Title="{DynamicResource Bovespa.Corretagem.Label.CadastroDescontrosAcrescimos}"
	x:Class="Sinacor.UI.Bovespa.Corretagem.View.SmartClient.CadastroDescontos"
    ModulePlus="False"
    ModuleId="ORD"
    >
    <Controls:SinacorExpanderContainer x:Name="ExpanderContainer" VerticalAlignment="Stretch">
        <Controls:SinacorTabControl HorizontalAlignment="Stretch"
                                    VerticalAlignment="Stretch"
                                    IsSynchronizedWithCurrentItem="True"
                                    x:Name="tabControle">
            <Controls:SinacorTabItem Header="{DynamicResource Bovespa.Corretagem.Label.NegocioAfterMarket}" x:Name="tbiAfterMarket" >
                <Grid>
                    <Controls:SinacorExpanderContainer x:Name="ExpanderContainer1"
                                                       VerticalAlignment="Stretch">
                        <Controls:SinacorExpander HorizontalAlignment="Stretch" x:Name="expAfterMarket"
                                                  VerticalAlignment="Stretch"
                                                  Header="{DynamicResource Bovespa.Corretagem.Label.AfterMarket}" IsExpanded="True" AllowExpand="False">
                            <Grid>
                                <Controls:SinacorDataGrid VerticalAlignment="Stretch"
                                                          Height="Auto"
                                                          IsSynchronizedWithCurrentItem="True"
                                                          x:Name="grdAfterMarket" 
                                                          ItemsSource="{Binding Path=ListaDescontoAfterMarket}"
                                                          AllowCancelInsert="True"
                                                          AllowEndInsert="True"
                                                          AllowDelete="True"
                                                          AllowBeginInsert="True"
                                                          AllowEndUpdate="False"
                                                          BeingInserted="grdAfterMarket_BeingInserted"
                                                          EndingInsert="grdAfterMarket_EndingInsert"
                                                          CancelingInsert="grdAfterMarket_CancelingInsert"
                                                          Deleting="grdAfterMarket_Deleting"
                                                          SelectionMode="Single" 
                                                          InsertEnded="grdAfterMarket_InsertEnded"
                                                          >

                                    <Controls:SinacorDataGrid.Columns>
                                        <Controls:Column Name="cmnInicio" 			
                                                         Title="Bovespa.Corretagem.Label.DataInicio" 			
                                                         IsRequired="True" 				
                                                         HorizontalCellAlignment="Center"
                                                         AllowInsert="True"   
                                                         DisplayMemberPath="Periodo.DataInicial"
                                                         StringFormat="d"
                                                         AutoAdjustWidthToContent="False"
                                                         Width="105"
                                                         >
                                            <Controls:Column.CellInsertTemplate>
                                                <DataTemplate>
                                                    <Controls:SinacorDatePicker
                                                        Value="{Binding Periodo.DataInicial,UpdateSourceTrigger=PropertyChanged}" 
                                                        x:Name="dtpDataInicioCliente"
                                                        >
                                                    </Controls:SinacorDatePicker>
                                                </DataTemplate>
                                            </Controls:Column.CellInsertTemplate>
                                        </Controls:Column>
                                        <Controls:Column Name="cmnFim" 			
                                                         Title="Bovespa.Corretagem.Label.DataFim" 			
                                                         IsRequired="True" 			
                                                         HorizontalCellAlignment="Center"   
                                                         AllowInsert="True"   
                                                         DisplayMemberPath="Periodo.DataFinal" 
                                                         StringFormat="d"
                                                         AutoAdjustWidthToContent="False"
                                                         Width="105"
                                                         >
                                            <Controls:Column.CellInsertTemplate>
                                                <DataTemplate>
                                                    <Controls:SinacorDatePicker
                                                        Value="{Binding Periodo.DataFinal,UpdateSourceTrigger=PropertyChanged}" 
                                                        x:Name="dtpDataFinalCliente" 
                                                        >
                                                    </Controls:SinacorDatePicker>
                                                </DataTemplate>
                                            </Controls:Column.CellInsertTemplate>
                                        </Controls:Column>
                                        <Controls:Column Name="cmnPorcAllIn" 			
                                                         Title="Bovespa.Corretagem.Label.AllIn" 			
                                                         IsRequired="True" 			
                                                          HorizontalCellAlignment="Right"
                                                         AllowInsert="True"   
                                                         DisplayMemberPath="PercentualAllIn"
                                                         StringFormat="N8"
                                                         Decimals="8"
                                                         Integers="3"
                                                         
                                                         >
                                            <Controls:Column.CellInsertTemplate>
                                                <DataTemplate>
                                                    <Controls:SinacorDecimalTextBox
                                                        Value="{Binding PercentualAllIn}" 
                                                        x:Name="textPercentualAllIn" 
                                                        Decimals="8"
                                                        Integers="3"
                                                        IsReadOnly="False"
                                                        AcceptsNegative="False"
                                                        >
                                                    </Controls:SinacorDecimalTextBox>
                                                </DataTemplate>
                                            </Controls:Column.CellInsertTemplate>
                                        </Controls:Column>
                                        <Controls:Column Name="cmnDescAcres" 			
                                                         Title="Bovespa.Corretagem.Label.DescontoAcrescimo" 			
                                                         IsRequired="True" 			
                                                         HorizontalCellAlignment="Right"
                                                         AllowInsert="True"  
                                                         DisplayMemberPath="PercentualDescontoAcresimo"
                                                         StringFormat="N8"
                                                         Decimals="8"
                                                         Integers="3"
                                                         
                                                         >
                                            <Controls:Column.CellInsertTemplate>
                                                <DataTemplate>
                                                    <Controls:SinacorDecimalTextBox
                                                        Value="{Binding PercentualDescontoAcresimo}" 
                                                        x:Name="textPercentualAcrescimo" 
                                                        Integers="3" 
                                                        Decimals="8"
                                                        AcceptsNegative="True"
                                                        >
                                                    </Controls:SinacorDecimalTextBox>
                                                </DataTemplate>
                                            </Controls:Column.CellInsertTemplate>
                                        </Controls:Column>

                                    </Controls:SinacorDataGrid.Columns>
                                </Controls:SinacorDataGrid>
                            </Grid>
                        </Controls:SinacorExpander>
                    </Controls:SinacorExpanderContainer>
                </Grid>
            </Controls:SinacorTabItem>
            <Controls:SinacorTabItem Header="{DynamicResource Bovespa.Corretagem.Label.PorOperacao}" x:Name="tbiOperacao">
                <Grid>
                    <Controls:SinacorLabel HorizontalAlignment="Left"
                                           Content="{DynamicResource Bovespa.Corretagem.Label.Cliente}"
                                           Width="63"/>
                    <Controls:SinacorTextBox HorizontalAlignment="Left"
                                             VerticalAlignment="Top"
                                             Text="{Binding FiltroDescontoCliente.ApelidoCliente}"
                                             LostFocus="textApelidoCliente_LostFocus"
                                             Margin="65,0,0,0"
                                             Width="180"
                                             MaxLength="18" 
                                             TabIndex="1"
                                             x:Name="textApelidoCliente"
                                             />
                    <Controls:SinacorButton HorizontalAlignment="Left"
                                            VerticalAlignment="Top"
                                            Content=""
                                            Margin="253,0,0,0"
                                            Icon="IconButtonClient"
                                            TabIndex="2"
                                            x:Name="btnPesquisarCliente"
                                            OnBufferedClick="btnPesquisarCliente_OnBufferedClick"
                                            ToolTip="{DynamicResource Bovespa.Corretagem.Label.PesquisarCliente}"/>
                    
                    <Controls:SinacorLabel HorizontalAlignment="Left"
                                           Content="{DynamicResource Bovespa.Corretagem.Label.TipoOperacao}"
                                           Margin="290,0,0,0"
                                           Width="120"/>

                    <Controls:SinacorComboBox HorizontalAlignment="Left"
                                              VerticalAlignment="Top"
                                              IsSynchronizedWithCurrentItem="False"
                                              Margin="415,0,0,0"
                                              Width="200"
                                              TabIndex="3"
                                              x:Name="cmbTipoOperacao"
                                              ItemsSource="{Binding PresenterCadastroDesconto.EnumsTipoOperacaoDesconto, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorWindow}}}"
                                              SelectedValue="{Binding FiltroDescontoCliente.TipoOperacao, UpdateSourceTrigger=PropertyChanged}"
                                              
                                              />

                    <Controls:SinacorButton HorizontalAlignment="Left"
                                            VerticalAlignment="Top"
                                            Content="{DynamicResource Bovespa.Corretagem.Label.Pesquisar}"
                                            Margin="620,0,0,0"
                                            Width="85"
                                            TabIndex="4"
                                            x:Name="btnPesquisa"
                                            OnBufferedClick="btnPesquisa_OnBufferedClick"
                                            IsDefault="True"/>
                    <Controls:SinacorButton HorizontalAlignment="Left"
                                            VerticalAlignment="Top"
                                            Content="{DynamicResource Bovespa.Corretagem.Label.NovaPesquisa}"
                                            Margin="710,0,0,0"
                                            TabIndex="5"
                                            x:Name="btnNovaPesquisa"
                                            OnBufferedClick="btnNovaPesquisa_OnBufferedClick"
                                            Width="106"/>
                    <Controls:SinacorExpanderContainer x:Name="ExpanderContainer2"
                                                       VerticalAlignment="Stretch">
                        <Controls:SinacorExpander HorizontalAlignment="Stretch"
                                                  VerticalAlignment="Stretch"
                                                  Header="{DynamicResource Bovespa.Corretagem.Label.Operacao}"
                                                  x:Name="expPorOperacao"
                                                  Margin="0,32,0,0" IsExpanded="True" AllowExpand="False">
                            <Grid>
                                <Controls:SinacorDataGrid VerticalAlignment="Stretch"
                                                          Height="Auto"
                                                          IsSynchronizedWithCurrentItem="True"
                                                          x:Name="grdOperacao"
                                                          ItemsSource="{Binding Path=ListaDescontoCliente}"
                                                          AllowBeginInsert="True"
                                                          AllowBeginUpdate="True"
                                                          AllowDelete="True"
                                                          BeingInserted="grdOperacao_BeingInserted"
                                                          BeingUpdated="grdOperacao_BeingUpdated"
                                                          EndingInsert="grdOperacao_EndingInsert"
                                                          EndingUpdate="grdOperacao_EndingUpdate"
                                                          Deleting="grdOperacao_Deleting"
                                                          SelectionMode="Single"
                                                          >

                                    <Controls:SinacorDataGrid.Columns>
                                        <Controls:Column Name="cmnCliente" 	
                                                         Title="Bovespa.Corretagem.Label.Cliente" 
                                                         IsRequired="False" 			
                                                         HorizontalCellAlignment="Left"
                                                         AllowInsert="True"   
                                                         MinWidth="130"
                                                         AllowUpdate="False"
                                                         DisplayMemberPath="ApelidoCliente"
                                                         CellInsertTemplate="{Binding CellUpdateTemplate, RelativeSource={RelativeSource Self}}">
                                            <Controls:Column.CellUpdateTemplate>
                                                <DataTemplate>
                                                    <Controls:SinacorTextBox
                                                        Text="{Binding ApelidoCliente}" 
                                                        x:Name="textApelidoCliente" 
                                                        MaxLength="18"  
                                                        LostFocus="txtApelidoCliente_LotFocus"
                                                        IsRequired="False"
                                                        >
                                                    </Controls:SinacorTextBox>
                                                </DataTemplate>
                                            </Controls:Column.CellUpdateTemplate>
                                        </Controls:Column>
                                        <Controls:Column Name="cmnTipoOper" 			
                                                         Title="Bovespa.Corretagem.Label.TipoOperacao" 			
                                                         IsRequired="False" 	
                                                         MinWidth="130"
                                                         HorizontalCellAlignment="Left" 
                                                         AllowInsert="True"   
                                                         AllowUpdate="False"
                                                         DisplayMemberPath="TipoOperacao"
                                                         CellInsertTemplate="{Binding CellUpdateTemplate, RelativeSource={RelativeSource Self}}">
                                            <Controls:Column.CellUpdateTemplate>
                                                <DataTemplate>
                                                    <Controls:SinacorComboBox 
                                                        x:Name="cmbTipoOperacaoGrid"
                                                        IsRequired="False"
                                                        SelectedValue="{Binding TipoOperacao, UpdateSourceTrigger=PropertyChanged}"
                                                        ItemsSource="{Binding PresenterCadastroDesconto.EnumsTipoOperacaoDesconto, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:SinacorWindow}}}">
                                                    </Controls:SinacorComboBox>
                                                </DataTemplate>
                                            </Controls:Column.CellUpdateTemplate>
                                        </Controls:Column>
                                        <Controls:Column Name="cmnDescAcres2" 			
                                                         Title="Bovespa.Corretagem.Label.DescontoAcrescimo" 			
                                                         IsRequired="False" 			
                                                         HorizontalCellAlignment="Right"
                                                         StringFormat="n8"
                                                         MinWidth="100"
                                                         Integers="4"
                                                         Decimals="8"
                                                         AllowInsert="True"   
                                                         AllowUpdate="True"
                                                         DisplayMemberPath="PercentualDescontoAcresimo"
                                                         CellInsertTemplate="{Binding CellUpdateTemplate, RelativeSource={RelativeSource Self}}">
                                            <Controls:Column.CellUpdateTemplate>
                                                <DataTemplate>
                                                    <Controls:SinacorDecimalTextBox
                                                        Value="{Binding PercentualDescontoAcresimo, UpdateSourceTrigger=PropertyChanged}" 
                                                        x:Name="textPercentualAcrescimoDescontoCliente" 
                                                        Integers="4" 
                                                        IsChangeMonitored="True"
                                                        IsFormated="True"
                                                        Decimals="8"
                                                        IsRequired="False"
                                                        AcceptsNegative="True"
                                                        >
                                                    </Controls:SinacorDecimalTextBox>
                                                </DataTemplate>
                                            </Controls:Column.CellUpdateTemplate>
                                        </Controls:Column>
                                    </Controls:SinacorDataGrid.Columns>
                                </Controls:SinacorDataGrid>
                            </Grid>
                        </Controls:SinacorExpander>
                    </Controls:SinacorExpanderContainer>
                </Grid>
            </Controls:SinacorTabItem>
        </Controls:SinacorTabControl>
    </Controls:SinacorExpanderContainer>
</Controls:SinacorWindow>
